<template>
  <div class="contact_medical_consultant">
    <div class="consultant_title">
      <img src="@/static/images/aepartment/left_signal.png" class="signal">
      <div class="consultant_font">Contact Medical Consultant</div>
      <img src="@/static/images/aepartment/right_signal.png" class="signal">
    </div>
    <div :class="current == 'Global' ? 'condition condition2' : 'condition'" @click="current = 'Global'">Global Drug Search</div>
    <div :class="current == 'Clinical' ? 'condition condition2' : 'condition'" @click="current = 'Clinical'">Clinical recruitment</div>
    <div :class="current == 'overseas' ? 'condition condition2' : 'condition'" @click="current = 'overseas'">overseas medical treatment</div>
    <div :class="current == 'Remote' ? 'condition condition2' : 'condition'" @click="current = 'Remote'">Remote consultation</div>
    <input placeholder="Please enter your phone number." class="phone_input" v-model="leaveWord.tel">
    <textarea placeholder="Please enter your content." class="content_input" v-model="leaveWord.content"/>
    <div class="note">Note: Our medical consultant will contact you as soon as possible. We promise to strictly protect your privacy.</div>
    <div class="submit" @click="submit()">Click to submit medical consultant</div>
  </div>
</template>

<script>
import { addLeaveWord } from '@/api/api'
export default {
  data () {
    return {
      "current":"",
      "leaveWord":{
        "type":'02',
        "lyType":'',
        "name":'',
        "tel":'',
        "content":'',
      }
    }
  },
  methods:{
    submit(){
      switch (this.current){
        case "Global":
          this.leaveWord.lyType = '01'
          break;
        case "Clinical":
          this.leaveWord.lyType = '02'
          break;
        case "overseas":
          this.leaveWord.lyType = '03'
          break;
        case "Remote":
          this.leaveWord.lyType = '04'
          break;
        default:
          this.leaveWord.lyType = ''
      }
      if(null == this.leaveWord.tel || '' == this.leaveWord.tel){
        this.$notify({
          showClose: true,
          message: 'Please enter your phone number.',
          type: 'warning'
        });
        return;
      }
      this.$axios.post(addLeaveWord, this.leaveWord).then(res => {
        this.$notify({
          title: 'tip',
          message: res.msg,
        });
      })
      this.leaveWord.lyType = ''
      this.leaveWord.tel = ''
      this.leaveWord.content = ''
    },
  }
}
</script>

<style lang="scss" scoped>
.contact_medical_consultant{
  margin-top: 32px;
  .consultant_title{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 14px;
    .signal{
      width: 20px;
      height: 10px;
    }
    .consultant_font{
      font-weight: bold;
      font-size: 19px;
      color: #0041A3;
      line-height: 68px;
    }
  }
  .condition{
    font-weight: 400;
    font-size: 18px;
    color: #0041A3;
    line-height: 48px;
    text-align: center;
    border: 1px solid #0041A3;
    margin-bottom: 16px;
    cursor: pointer;
  }
  .condition2{
    background: rgba(0,120,255,0.1);
    color: #0041A3;
    border: 1px solid rgba(0,120,255,0.1);
  }
  .phone_input{
    border: 1px solid #CBD1D7;
    width: 336px;
    font-weight: 400;
    font-size: 16px;
    color: #353a42;
    line-height: 48px;
    padding-left: 16px;
    box-sizing: border-box;
    margin-bottom: 16px;
  }
  .content_input{
    max-width: 336px;
    min-width: 336px;
    height: 81px;
    border: 1px solid #CBD1D7;
    font-weight: 400;
    font-size: 16px;
    color: #353a42;
    padding: 10px 0 0 16px;
    box-sizing: border-box;
    outline: none;
    font-family: Microsoft YaHei;
  }
  .note{
    font-weight: 400;
    font-size: 12px;
    color: #0041A3;
    line-height: 19px;
    margin-top: 14px;
  }
  .submit{
    background: #0041A3;
    font-weight: bold;
    font-size: 16px;
    color: #FFFFFF;
    line-height: 49px;
    text-align: center;
    margin-top: 14px;
    cursor: pointer;
  }
}
</style>